@extends('layouts.admin.master')

@section('content')
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <br/>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        添加分类
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        @include('admin.common.errors')
                        <form class="form-horizontal" role="form" method="post"
                              action="{{ route('admin.article_categories.store') }}">
                            {{ csrf_field() }}
                            <div class="form-group">
                                <label for="inputName" class="col-sm-2 control-label">分类名称</label>

                                <div class="col-sm-4">
                                    <input type="text" name="name" class="form-control" id="inputName"
                                           value="{{ old('name') }}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="selectParentId" class="col-sm-2 control-label">上级分类</label>

                                <div class="col-sm-4">
                                    <select id="selectParentId" name="parent_id" class="form-control">
                                        <option value="0">=====上级分类=====</option>
                                        @foreach($treeArray as $v)
                                            <option value="{{ $v[0] }}" {{ old('parent_id') == $v[0] ? 'selected="selected"' : '' }} >{{ str_repeat('&nbsp;&nbsp;', $v[2]) . $v[1] }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" class="btn btn-default">确认</button>
                                </div>
                            </div>
                        </form>
                        <!-- /.form-horizontal -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
@endsection